import type { ArticleForm, GetChannlesList } from "@/types/article";
import type { ListResponse, reqParams } from "@/types/user";
import { request } from "@/utils/https";

export const getAllList = (params:reqParams)=>{
  return request<ListResponse>('/v1_0/mp/articles','GET',params)
}

/**
 * 删除文章
 * @param {string} id 文章id
 */
export const delEnterpriseAPI = (id:string)=>{
  return request('/v1_0/mp/articles/'+id,'DELETE')
}

export const getArticleListAPI = (params:object)=>{
  return request('/v1_0/mp/articles', 'GET', params)
}

export const getArticleFormAPI = (data:ArticleForm)=>{
  return request('/v1_0/mp/articles','POST',data)
}

export const getChannelsListAPI = ()=>{
  return request<GetChannlesList>('/v1_0/channels','GET')
}

/**
 * 发布文章
 */
export const publishArticleAPI = (data:ArticleForm)=>{
  return request('/v1_0/mp/articles','POST',data)
}

/**
 * 修改个人信息
 */
export const editUserAPI = (data:object)=>{
  return request('/v1_0/user/profile','PATCH',data)
}
